<?php
	/*\
     *  Gladius - oh.framework
     *  ----------------------
     *  name: gladius
     *  sign: 
     *  description: manage a flatfile database
    \*/
	
	/*\
	 * 	Verify the module integrity 
	\*/	oh_module_header();
		
	// scandiano la citta 100% comunista
    // Main function of module  
    function oh_module_gladius($tokens) {
		global $oh_object_gladius;
		return $oh_object_gladius;
	} 

	// Option file required
	require_once(dirname(__FILE__)."/gladius-0.8.1/gladius.php");
	require_once(dirname(__FILE__)."/gladius.class.php");
	
	// Main class of module
	class oh_class_gladius extends the_gladius {
		function oh_class_gladius() {
			global $oh;
			
			if (oh("config")->have("db.path")) {
				$path = oh("config.db.path");	
			} else {
				$path = $oh['path'].'/modules/gladius/db/';
				oh("config")->set("db.path",$path);
			}
			$this->SetDBRoot($path);
			
			if (oh("config")->have("db.name")) {
				$name = oh("config.db.name");
			} else {
				$name = "DB0";
			}
			if (!$this->db_exists($name)) {
			    $this->db_create($name);
			} 
			$this->db_use($name);
		}
		function is_ready() {
			return true;
		}
	}
	
	// Main object of module
	global $oh_object_gladius;
	$oh_object_gladius = new oh_class_gladius();
?>
